<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>{$title}</title>


<JS href="../Public/js/jq.js" />
<script>
$().ready(function(){
	$(':checkbox').attr('checked','');
	$('#selectall').change(function() {
		if ($('#selectall').attr('checked') == true) {
			$('.ctl').attr('checked', 'checked');
		} else {
			$('.ctl').attr('checked', '');
		}
	})
	
	
})
function add()
{
	if($('.addname').val()=='')
		{
		alert('请输入专业名称');
		$('.addname').focus();
		}else
		{
			name = $('.addname').val();
			pid = $('#parent').val();
			$.post('__URL__/savespeciality/',{
				'title':name,
				'pid':pid
			},function()
			{
				window.location.reload();
			})
		}
}
function del() {
	arr = null;
	$('.ctl').each(function() {
		if ($(this).attr('checked') == true) {
			if (arr == null)
				arr = $(this).val();
			else
				arr += ',' + $(this).val();
		}
	})
	if (arr == null) {
		alert('未选择任何数据');
	} else {
		$.post('__URL__/deletespeciality/',{
			'id':arr
		},function(data){
			window.location.reload();
		})
	}

}
</script>
</head>
<body>

<present name="sepcialitytable">
<table border="1">
<tr><td>&nbsp;</td><td>专业名称</td></tr>
{$sepcialitytable}
</table>
<p>全选:<input type="checkbox" id="selectall" /> 选中项：<input
	type="button" onclick="del()" value="删除"  /><i>删除专业有可能会导致不可预料错误，谨慎删除</i></p>
</present>




<div class="addspeciality">

专业名称：<input type="text" class="addname" name="addname" />
所属栏目:<select id="parent"><option value="0">一级栏目</option>
{$specialityselect}
</select>
<input type="button" onclick="add()" value="添加" />
<p><i>注：所有专业只有二级栏目的才能生效。并且请不要添加超过2级栏目。</i></p>

</div>
</body>
</html>